
import Head from 'next/head'

<Head>
  <script>
    {
      `(function() {
         var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?e60fb290e204e04c5cb6f79b0ac1e697";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
       })();`
    }
  </script>
</Head>

![LangChain](https://pica.zhimg.com/50/v2-56e8bbb52aa271012541c1fe1ceb11a2_r.gif)




Writer
===

[Writer](https://writer.com/) 是一个生成不同语言内容的平台。

本示例将介绍如何使用LangChain与`Writer` [models](https://dev.writer.com/docs/models)进行交互。

您需要从[此处](https://dev.writer.com/docs)获取`WRITER_API_KEY`。

```python
from getpass import getpass

WRITER_API_KEY = getpass()

```

```python
import os

os.environ["WRITER_API_KEY"] = WRITER_API_KEY

```

```python
from langchain.llms import Writer
from langchain import PromptTemplate, LLMChain

```

```python
template = """Question: {question}

Answer: Let's think step by step."""

prompt = PromptTemplate(template=template, input_variables=["question"])

```

```python
# If you get an error, probably, you need to set up the "base_url" parameter that can be taken from the error log.

llm = Writer()

```

```python
llm_chain = LLMChain(prompt=prompt, llm=llm)

```

```python
question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"

llm_chain.run(question)

```

